/**
 * Created by songj on 2015/12/11.
 */
define(['angular',
    'framework/msg/GillionMsgModule',
    'framework/dataGrid/DataGridModule',
    'framework/pagination/GillionPaginationModule',
    'framework/datasource/DataSourceModule',
    'framework/dropdown/GillionDropdownModule',
    'framework/date/DateModule',
    'angular-underscore'
], function (angular) {
    var module = angular.module('indexModule',
        ['GillionMsgModule', 'DataGridModule', 'GillionPaginationModule',
            'DataSourceModule', 'DateModule', 'GillionDropdownModule'])
        .controller('IndexController', ['$scope', 'GillionMsgService', '$dataSourceManager', '$timeout', 'Arrays', "$location",
                function ($scope, GillionMsgService, $dataSourceManager, $timeout, Arrays, $location) {

                    $scope.$on("allProjectSource", function (context, dataSource) {
                        angular.extend($scope, dataSource.records);
                    });

                    $timeout(function () {
                        var param = {};
                        $dataSourceManager.dataSources["allProjectSource"].params = param;
                        $dataSourceManager.dataSources["allProjectSource"].doRequestData();
                    },100);
                }
            ]
        );
    return module;

});
